package com.bentley.kotlindemo.ui.kits.bottomtab.fragments

import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import com.bentley.kotlindemo.R
import com.bentley.kotlindemo.base.BaseFragment
import com.bentley.kotlindemo.databinding.BottomtabMovieFragmentBinding
import com.bentley.kotlindemo.ui.kits.home.HomeActivity

/**
 * <pre>
 *  ┌────────────────────────────────────────────
 *  │ @author  Lee  @date 2021/3/26 16:58
 *  ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
 *  │ @desc
 *  └────────────────────────────────────────────
 * </pre>
 */
class MovieFragment :BaseFragment<BottomtabMovieFragmentBinding,MovieFragmentModel>() {
    override fun initView(savedInstanceState: Bundle?) {
        dataBinding.tv1.setText("ffsdfsadfas")
    }

    override fun getLayoutId(): Int = R.layout.bottomtab_movie_fragment

    override fun initViewCreated(savedInstanceState: Bundle?) {
        setHasOptionsMenu(true)
    }

    override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
        inflater.inflate(R.menu.tasks_fragment_menu, menu)
    }

    override fun onOptionsItemSelected(item: MenuItem) =
        when (item.itemId) {
            R.id.menu_clear -> {

                context?.startActivity(Intent(context,HomeActivity::class.java))
                true
            }
            R.id.menu_filter -> {
                context?.startActivity(Intent(context,HomeActivity::class.java))
//                showFilteringPopUpMenu()
                true
            }
            R.id.menu_refresh -> {
//                viewModel.loadTasks(true)
                true
            }
            else -> false
        }

}